package ui.popups
{
	import base.PopupBase;
	
	import feathers.controls.Button;
	import feathers.core.PopUpManager;
	
	import starling.display.Quad;
	import starling.events.Event;
	import starling.text.TextField;
	import starling.utils.HAlign;
	import starling.utils.VAlign;
	
	public class WinPopup extends PopupBase
	{
		private var bg:Quad;
		private var btnClose:Button;
		public function WinPopup()
		{
			super();
		}
		private function onClose(e:Event):void{
			PopUpManager.removePopUp(this,true);
		}
		
		override protected function draw():void
		{
			// TODO Auto Generated method stub
			super.draw();
			btnClose.x = bg.width - btnClose.width/2;
			btnClose.y = -btnClose.height/2;
			btnClose.validate();
			setSizeInternal(bg.width,bg.height,true);
		}
		
		override protected function initialize():void
		{
			// TODO Auto Generated method stub
			super.initialize();
			bg = new Quad(200,200,0xF1AA00);
			addChild(bg);
			
			btnClose = new Button();
			btnClose.nameList.add("test");
			btnClose.label ="X";
			btnClose.addEventListener(Event.TRIGGERED,onClose);
			addChild(btnClose);
			
			var textWin:TextField = new TextField(bg.width,bg.height,"You WIN!","Verdana",14);
			textWin.hAlign = HAlign.CENTER;
			textWin.vAlign = VAlign.CENTER;
			addChild(textWin);
		}
	}
}